<%@ page import="util.DBUtil" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>在线商城</title>
</head>
<body>
<h2>在线商城</h2>
<a href="cart.jsp" target="_blank">我的购物车</a>
<a href="myorder.jsp" target="_blank">我的订单</a>
<table>
    <%
        String sql="select * from tb_product "
                +" where status =1 "
                + " order by is_top desc,idx asc";
        DBUtil dbUtil=new DBUtil();
        ResultSet rs=dbUtil.query(sql);
        while(rs.next()){
    %>
    <tr>
        <td> <%=rs.getString("product_name")%></td>
        <td> 价格：<%=rs.getString("price")%></td>
        <td> 促销价：<%=rs.getString("sale_price")%></td>
        <td><a href="cart_add.jsp?id=<%=rs.getInt("id")%>"> 加入购物车</a> </td>
    </tr>
    <%
        }
    %>
</table>
</body>
</html>
